home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Linux
/
Kubuntu 8.10
/
kubuntu-8.10-desktop-i386.iso
/
casper
/
filesystem.squashfs
/
usr
/
lib
/
pm-utils
/
sleep.d
/
90clock
< prev
next >
Wrap
Text File
|
2008-10-15
|
821b
|
42 lines
#!/bin/sh
# Synchronize system time with hardware time.
# TODO: Split NTP handling to its own hook. Having it here is ugly and silly.
# Do modern kernels handle this correctly? If so, we should detect that
# and skip this hook.
. "${PM_FUNCTIONS}"
NTPD_LOCK="pm-ntpd.lock"
suspend_clock()
{
if try_lock "${NTPD_LOCK}"; then
trap 'release_lock "${NTPD_LOCK}"' 0
stopservice ntpd
fi
/sbin/hwclock --systohc >/dev/null 2>&1 0<&1
}
resume_clock()
{
/sbin/hwclock --hctosys >/dev/null 2>&1 0<&1
rc=$?
# Bring back ntpd _after_ NetworkManager and such come back...
( spin_lock "${NTPD_LOCK}";
trap 'release_lock "${NTPD_LOCK}"' 0
sleep 20;
restartservice ntpd; ) &
return $rc
}
case "$1" in
hibernate|suspend)
suspend_clock
;;
thaw|resume)
resume_clock
;;
*) exit $NA
;;
esac